/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package healthcare.coursework.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 *
 * @author Administrator
 */
@Embeddable
public class DiagnosesPK implements Serializable {
    @Basic(optional = false)
    @Column(name = "PATIENT_ID", nullable = false)
    private long patientId;
    @Basic(optional = false)
    @Column(name = "USERNAME", nullable = false, length = 20)
    private String username;
    @Basic(optional = false)
    @Column(name = "SERVICE_ID", nullable = false)
    private int serviceId;

    public DiagnosesPK() {
    }

    public DiagnosesPK(long patientId, String username, int serviceId) {
        this.patientId = patientId;
        this.username = username;
        this.serviceId = serviceId;
    }

    public long getPatientId() {
        return patientId;
    }

    public void setPatientId(long patientId) {
        this.patientId = patientId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public int getServiceId() {
        return serviceId;
    }

    public void setServiceId(int serviceId) {
        this.serviceId = serviceId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) patientId;
        hash += (username != null ? username.hashCode() : 0);
        hash += (int) serviceId;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DiagnosesPK)) {
            return false;
        }
        DiagnosesPK other = (DiagnosesPK) object;
        if (this.patientId != other.patientId) {
            return false;
        }
        if ((this.username == null && other.username != null) || (this.username != null && !this.username.equals(other.username))) {
            return false;
        }
        if (this.serviceId != other.serviceId) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "healthcare.coursework.model.DiagnosesPK[patientId=" + patientId + ", username=" + username + ", serviceId=" + serviceId + "]";
    }

}
